home *** CD-ROM | disk | FTP | other *** search
Wrap
' ########################################################################### ' ################### ################# ' ################### ATTACK!!! ################# ' ################### BY RON SCHAEFER ################# ' ################### COPYRIGHT 1989 ANTIC PUBLISHING ################# ' ################### ################# ' ########################################################################### DEFMOUSE 0 DEFINT "n" !any variable that begins with n is an integer DEFTEXT 1,0,0,4 ON BREAK GOSUB clean_up noe%=12 ! NOE = Number Of Enemy ' ------- DIMINSION ARRAYS ------- DIM spalette%(16,3),posx%(4),l$(4),s$(3),e$(20),mex%(noe%),mey%(noe%),espeed%(noe%) DIM screen%(32255/4),fact%(noe%),fx%(noe%),fy%(noe%),fire!(noe%),finc%(noe%),b$(3) DIM e_hit!(noe%),blast%(noe%),e!(noe%),type_e%(noe%),e_visable!(noe%),h$(2) DIM efact%(noe%,10),efx%(noe%,10),efy%(noe%,10),efire!(noe%,10),efinc%(noe%,10) DIM num_e_rockets%(15),ne_s_max%(15),ne_ch_max%(15),ne_ud_max%(15) ! 15/3=6 types of enemy DIM scores%(10),array_names$(10),index%(10) ' path$=DIR$(0)+"\" !set path for graphics rez%=XBIOS(4) ACLIP 1,0,0,319,199 IF rez%<>0 THEN ALERT 3,"|Sorry this program runs in|low resolution only.",1," OK ",junk# EDIT ENDIF ' IF NOT EXIST(path$+"ATAK_TIT.PI1") ALERT 3,"| The file ATAK_TIT.PI1 must | be in the same directory | as ATTACK.PRG.",1,"Abort",d# EDIT ENDIF IF NOT EXIST(path$+"ATTACK1.PI1") ALERT 3,"| The file ATTACK1.PI1 must | be in the same directory | as ATTACK.PRG.",1,"Abort",d# EDIT ENDIF IF NOT EXIST(path$+"ATTACK2.PI1") ALERT 3,"| The file ATTACK2.PI1 must | be in the same directory | as ATTACK.PRG.",1,"Abort",d# EDIT ENDIF ' @save_pal !save original palette FOR i#=0 TO 15 SETCOLOR i#,0,0,0 NEXT i# ' @deg_load(path$+"ATTACK1.PI1",0) @cutpics1 ' @deg_load(path$+"ATTACK2.PI1",0) @cutpics2 ' CLS @deg_load(path$+"ATAK_TIT.PI1",-1) !load title picture GET 185,3,298,99,moon$ ' @initvar !initiate variables ~INP(2) CLS a%=XBIOS(3) !set up parameters for screen swapping b%=(VARPTR(screen%(0))+255) AND &HFFFF00 TEXT 1,6,"SCORE:" TEXT 64,6,"SHIELDS:" TEXT 149,6,"FUEL:" TEXT 197,6,"ENEMY:" TEXT 248,6,"HYPERKILL:" SGET h$ VSYNC ' ====================== MAIN PROGRAM LOOP ============================== DO key$=INKEY$ INC tmr% IF key$<>"" !check for keyboard input IF key$="q" OR key$="Q" !quit game clean_up EDIT ELSE IF key$="p" OR key$="P" !pause game TEXT 130,100,"PAUSING" TEXT 100,109,"ANY KEY TO CONTINUE" landscape @score PUT mx%,my%,s$(ts%),7 ! Your Ship @enemy SWAP a%,b% VOID XBIOS(5,L:a%,L:b%,-1) SPUT h$ VOID INP(2) ELSE IF key$=" " !Hyperkill hyperkill ENDIF ENDIF @landscape @turnship @joystick @enemy @enemy_fire @firerockets @collision @incomming @bumper @ground @score PUT mx%,my%,s$(ts%),7 ! Your Ship IF EVEN(tmr%) @cycle_colors IF the_enemy%<=0 AND shields%>0 @new_wave ELSE IF shields%<=0 @game_over ENDIF ENDIF SWAP a%,b% VOID XBIOS(5,L:a%,L:b%,-1) VSYNC SPUT h$ IF new_wave! new_wave!=FALSE ds1(4,3) PAUSE 5 ds1(4,4) PAUSE 5 ds1(4,5) WAVE 0,0 PAUSE 30 ENDIF LOOP @clean_up ' =========================== END OF MAIN PROGRAM ======================== ' By modifying these variables you can significantly change the difficulty ' of the game play. If you have a mega with a bliter you will need to either ' turn the blitter off or else slow down the enemy. PROCEDURE initvar STICK 1 shields%=15 ! Initial shield strength for your ship hyper%=5 ! Hyper distruct kills num_enemy%=1 ! Number of enemy (6 types) max_speed%=20 ! Your max speed num_rockets%=5 ! Number of rockets ' -------------------- SHIP TYPE 1-3 DART --------------------------- num_e_rockets%(0)=2 ! Number of enemy rockets ne_s_max%(0)=10 ! Enemy max speed horizontal ne_ch_max%(0)=1 ! Max change in horizontal speed ne_ud_max%(0)=1 ! Enemy max speed up or down ' -------------------- SHIP TYPE 4-6 JET -------------- num_e_rockets%(3)=5 ! Number of enemy rockets ne_s_max%(3)=21 ! Enemy max speed horizontal ne_ch_max%(3)=1 ! Max change in horizontal speed ne_ud_max%(3)=1 ! Enemy max speed up or down ' -------------------- SHIP TYPE 7-9 MOSQUITO -------------- num_e_rockets%(6)=5 ! Number of enemy rockets ne_s_max%(6)=12 ! Enemy max speed horizontal ne_ch_max%(6)=2 ! Max change in horizontal speed ne_ud_max%(6)=2 ! Enemy max speed up or down ' -------------------- SHIP TYPE 10-12 FORK -------------- num_e_rockets%(9)=5 ! Number of enemy rockets ne_s_max%(9)=18 ! Enemy max speed horizontal ne_ch_max%(9)=2 ! Max change in horizontal speed ne_ud_max%(9)=2 ! Enemy max speed up or down ' -------------------- SHIP TYPE 13-15 BUS -------------- num_e_rockets%(12)=6 ! Number of enemy rockets ne_s_max%(12)=10 ! Enemy max speed horizontal ne_ch_max%(12)=2 ! Max change in horizontal speed ne_ud_max%(12)=2 ! Enemy max speed up or down ' -------------------- SHIP TYPE 16-18 SAUSER -------------- num_e_rockets%(15)=5 ! Number of enemy rockets ne_s_max%(15)=5 ! Enemy max speed horizontal ne_ch_max%(15)=4 ! Max change in horizontal speed ne_ud_max%(15)=8 ! Enemy max speed up or down ' ---------------------------------- e_up_down%=1 ! Percent time enemy will move up or down correctly ' --------------------- REFERENCE NUMBERS --------------------------- max_shields%=shields% max_hyper%=hyper% the_enemy%=num_enemy% orig_max_speed%=max_speed% ' ------------------------------------------------------------ bump%=9 ! Bumb between ships zone hitx1%=4 ! Hit zone for enemy ships hity1%=0 hitx2%=28 ! Hit zone for enemy ships hity2%=11 thresh%=10 ! Threshold for enemy to fire in Y coordinate system mx%=145 ! Position of your ship my%=100 shields$=STR$(shields%) score%=0 wave%=1 type%=0 nexte%=0 speed%=0 posx%(1)=0 posx%(2)=320 posx%(3)=640 posx%(4)=960 moonx%=185 small_moonx%=750 saturnx%=-310 ts%=1 ! turing status of your ship right=1 center=2 left=3 yright!=TRUE ! your ship starts off facing right yr%=1 ! 1=right and -1=left ARRAYFILL fire!(),FALSE ARRAYFILL fact%(),0 ARRAYFILL efire!(),FALSE ARRAYFILL efact%(),0 nexte%=0 @initenemy RETURN ' ------------------ Init enemy positions ---------------------------- PROCEDURE initenemy FOR n%=1 TO num_enemy% e!(n%)=TRUE DO mex%(n%)=RANDOM(940)-320 ! Initial x position of emeny EXIT IF mex%(n%)<0 OR mex%(n%)>320 LOOP mey%(n%)=RANDOM(140) ! Initial y position of emeny espeed%(n%)=RANDOM(10)-5 ! Initial speed of enemy NEXT n% RETURN ' ---------------------------- CYCLE COLORS ---------------------------- PROCEDURE cycle_colors !for flame and electrical effects INC cycle% SELECT cycle% CASE 1 VSETCOLOR 11,7,0,0 VSETCOLOR 14,0,0,0 CASE 2 VSETCOLOR 11,0,0,0 VSETCOLOR 14,7,0,0 CASE 3 cycle%=0 ENDSELECT RETURN ' ------------------------ HYPERKILL ------------------------------------ PROCEDURE hyperkill !kills all enemy on the screen IF hyper%>0 DEC hyper% hyperk!=TRUE explode1 FOR n%=1 TO num_enemy% IF e_visable!(n%) AND e!(n%) e!(n%)=FALSE e_hit!(n%)=TRUE ADD score%,10 DEC the_enemy% ENDIF NEXT n% ENDIF IF INKEY$=" " WHILE INKEY$=" " WEND ENDIF RETURN ' ----DETECT COLLISION WITH GROUND OR ENERGIZE SHIELDS AND INCREASE FUEL ---- PROCEDURE ground IF my%>145 COLOR 1 IF yright! test1%=POINT(ADD(mx%,12),ADD(my%,12)) test2%=POINT(ADD(mx%,14),ADD(my%,12)) ELSE test1%=POINT(ADD(mx%,20),ADD(my%,12)) test2%=POINT(ADD(mx%,22),ADD(my%,12)) ENDIF IF test1%<>0 OR test2%<>0 IF test1%=1 OR test1%=2 OR test1%=3 OR test1%=6 OR test2%=1 OR test2%=2 OR test2%=3 OR test2%=6 IF shields%>0 DEC shields% !hit ground explode2 ELLIPSE ADD(mx%,17),ADD(my%,7),20,10 ENDIF ELSE IF (test1%=5 OR test2%=5) AND shields%<max_shields% INC s_inc% IF MOD(s_inc%,1)=0 ds1(4,4) INC shields% !recharge shields ENDIF ELSE IF (test1%=11 OR test1%=14 OR test2%=11 OR test2%=14) AND max_speed%<orig_max_speed% INC sp_inc% IF MOD(sp_inc%,1)=0 ds1(2,3) INC max_speed% !refuel ship ENDIF ENDIF ENDIF ENDIF RETURN ' --------------- ENEMY FIRES AT YOU IF YOU ARE IN RANGE ------------------- PROCEDURE enemy_fire FOR ne%=1 TO num_enemy% IF e!(ne%) IF mex%(ne%)>mx%-160 AND mex%(ne%)<mx% AND mey%(ne%)<ADD(my%,thresh%) AND mey%(ne%)>ADD(my%,-thresh%) AND espeed%(ne%)<-2 eright%=30 sight!=TRUE er%=1 ELSE IF mex%(ne%)<mx%+160 AND mex%(ne%)>mx% AND mey%(ne%)<ADD(my%,thresh%) AND mey%(ne%)>ADD(my%,-thresh%) AND espeed%(ne%)>2 sight!=TRUE eright%=0 er%=-1 ENDIF ' ----------------------------------------------------------------------- IF sight! sight!=FALSE FOR n%=1 TO num_e_rockets%(type_e%(ne%)) IF efire!(ne%,n%)=FALSE AND et!=FALSE et!=TRUE efire!(ne%,n%)=TRUE efx%(ne%,n%)=ADD(mex%(ne%),eright%) efy%(ne%,n%)=ADD(mey%(ne%),8) efinc%(ne%,n%)=MUL(15,er%) ENDIF NEXT n% ENDIF ENDIF et!=FALSE COLOR 1 FOR n%=1 TO num_e_rockets%(type_e%(ne%)) IF efire!(ne%,n%) efxs%=ADD(efx%(ne%,n%),efact%(ne%,n%)) IF efxs%>0 AND efy%(ne%,n%)>0 AND efxs%<319 AND efy%(ne%,n%)<199 PSET efxs%,efy%(ne%,n%),15 ADD efact%(ne%,n%),efinc%(ne%,n%) IF ADD(efact%(ne%,n%),efx%(ne%,n%))>310 OR ADD(efact%(ne%,n%),efx%(ne%,n%))<0 efire!(ne%,n%)=FALSE efact%(ne%,n%)=0 ENDIF ENDIF ! endif for pset ENDIF NEXT n% NEXT ne% RETURN ' ----------------------------- GAME OVER ------------------------------- PROCEDURE game_over explode2 FOR nt%=1 TO 3 @score landscape PUT mx%,my%,b$(nt%),7 PUT mx%-12,my%+15,b$(nt%-1),7 PUT mx%+15,my%-12,b$(nt%),7 PUT mx%+15,my%+12,b$(nt%-1),7 PUT mx%-12,my%-17,b$(nt%),7 SWAP a%,b% VOID XBIOS(5,L:a%,L:b%,-1) SPUT h$ NEXT nt% FOR nt%=1 TO 3 @score landscape PUT mx%-5,my%,b$(nt%),7 PUT mx%+12,my%+15,b$(nt%-1),7 PUT mx%-15,my%-12,b$(nt%),7 PUT mx%-15,my%+12,b$(nt%-1),7 PUT mx%+12,my%-17,b$(nt%),7 SWAP a%,b% VOID XBIOS(5,L:a%,L:b%,-1) SPUT h$ NEXT nt% GRAPHMODE 2 FOR zz%=1 TO 12 @landscape @score ds1(5,zz%/2) DEFTEXT 5,0,0,zz% TEXT 95,100,0,"GAME OVER" DEFTEXT 4,0,0,zz% TEXT 94,99,0,"GAME OVER" DEFTEXT 1,0,0,4 SWAP a%,b% VOID XBIOS(5,L:a%,L:b%,-1) SGET endgame$ SPUT h$ NEXT zz% a%=MAX(a%,b%) VOID XBIOS(5,L:a%,L:a%,-1) SPUT endgame$ COLOR 1 PAUSE 25 @high_score(score%) BOX 9,135,69,150 BOX 7,133,72,152 BOX 245,135,305,150 BOX 243,133,307,152 DEFTEXT 1,0,0,6 TEXT 21,145,"AGAIN" TEXT 260,145,"QUIT" GRAPHMODE 3 pick%=0 SHOWM STICK 1 DO MOUSE x#,y#,k# IF x#>7 AND y#>133 AND x#<72 AND y#<152 AND k#=1 ds2(5,5) PBOX 7,133,73,150 PAUSE 10 @initvar pick%=1 HIDEM CLS a%=XBIOS(3) b%=(VARPTR(screen%(0))+255) AND &HFFFF00 ENDIF IF x#>245 AND y#>135 AND x#<305 AND y#<150 AND k#=1 ds2(5,5) PBOX 245,135,305,150 PAUSE 10 @clean_up pick%=2 ENDIF EXIT IF pick%<>0 LOOP GRAPHMODE 1 DEFTEXT 1,0,0,4 RETURN ' --------------------------------- HIGH SCORE ---------------------------- PROCEDURE high_score(hi_score%) IF EXIST(path$+"HISCORES.DAT") OPEN "I",#2,path$+"HISCORES.DAT" FOR n%=1 TO 10 index%(n%)=n% INPUT #2;scores%(n%),array_names$(n%) NEXT n% PRINT CLOSE #2 IF hi_score%>scores%(1) scores%(1)=hi_score% PRINT AT(5,3);"CONGRATULATIONS NEW HIGH SCORE" PRINT AT(5,4);"ENTER YOUR NAME: ____________"; PRINT AT(22,4); INPUT "",name$ array_names$(1)=name$ QSORT scores%(),11,index%() OPEN "O",#2,path$+"HISCORES.DAT" FOR n%=1 TO 10 PRINT #2,scores%(n%);",";array_names$(index%(n%)) NEXT n% CLOSE #2 @print_score ELSE @print_score ENDIF ELSE OPEN "O",#2,path$+"HISCORES.DAT" PRINT AT(5,3);"CONGRATULATIONS NEW HIGH SCORE" PRINT AT(5,4);"ENTER YOUR NAME: ____________"; PRINT AT(22,4); INPUT "",name$ FOR n%=1 TO 9 PRINT #2,"0,............" NEXT n% PRINT #2,hi_score%;",";name$ CLOSE #2 @print_score ENDIF RETURN ' ----------------------------------------------------------------- PROCEDURE print_score OPEN "I",#2,path$+"HISCORES.DAT" FOR n%=1 TO 10 INPUT #2,scores%(n%),array_names$(n%) NEXT n% CLOSE #2 DEFFILL 0,2,8 PBOX 80,36,234,142 BOX 80,36,234,142 BOX 78,34,236,144 PRINT AT(12,6);" HIGH SCORES" FOR n%=10 TO 1 STEP -1 PRINT AT(12,8+10-n%);scores%(n%);" ";LEFT$(array_names$(n%),12) NEXT n% RETURN ' ---------------------------- NEW WAVE OF ENEMY -------------------- PROCEDURE new_wave FOR nw%=1 TO 2 collision landscape score PUT mx%,my%,s$(ts%),7 SWAP a%,b% VOID XBIOS(5,L:a%,L:b%,-1) SPUT h$ NEXT nw% collision landscape score PUT mx%,my%,s$(ts%),7 IF EVEN(new_test%) INC num_enemy% ENDIF INC new_test% INC wave% IF num_enemy%>12 num_enemy%=12 ENDIF initenemy the_enemy%=num_enemy% FOR n%=1 TO 12 IF RND<0.5 THEN type%=nexte%+RANDOM(3)*3 ELSE type%=nexte% ENDIF IF type%>16 type%=0 ENDIF type_e%(n%)=type% NEXT n% ADD nexte%,3 IF nexte%>16 nexte%=0 ENDIF ARRAYFILL e_hit!(),FALSE ARRAYFILL fire!(),FALSE ARRAYFILL fact%(),0 ARRAYFILL efire!(),FALSE ARRAYFILL efact%(),0 TEXT 130,100,"NEW WAVE!" new_wave!=TRUE RETURN ' ------------------------------------- SCORE ---------------------------- PROCEDURE score TEXT 39,6,STR$(score%) TEXT 113,6,STR$(shields%)+"/"+shields$ TEXT 180,6,STR$(max_speed%) TEXT 234,6,STR$(the_enemy%) TEXT 310,6,STR$(hyper%) RETURN ' --------------------- BUMPER, DETECT MID AIR COLLISIONS ---------------------- PROCEDURE bumper FOR n%=1 TO num_enemy% IF e!(n%) AND e_visable!(n%) ' Box Mex%(N)+1,Mey%(N)+1,Mex%(N)-1,Mey%(N)-1 !can see zone of collision ' Box Mx%+Bump%,My%+Bump%,Mx%-Bump%,My%-Bump% IF mex%(n%)<ADD(mx%,bump%) AND mey%(n%)<ADD(my%,bump%) AND mex%(n%)>ADD(mx%,-bump%) AND mey%(n%)>ADD(my%,-bump%) e_hit!(n%)=TRUE e!(n%)=FALSE COLOR 3 ELLIPSE ADD(mx%,17),ADD(my%,7),20,10 explode2 DEC the_enemy% IF shields%>=2 SUB shields%,2 ELSE shields%=0 ENDIF ENDIF ENDIF NEXT n% RETURN ' -----------ENEMY, MOVE THE EMENY TOWARDS YOU ---------------------- PROCEDURE enemy FOR n%=1 TO num_enemy% IF e!(n%) e_visable!(n%)=FALSE IF mx%>mex%(n%) SUB espeed%(n%),ne_ch_max%(type_e%(n%)) IF espeed%(n%)<-ne_s_max%(type_e%(n%)) espeed%(n%)=-ne_s_max%(type_e%(n%)) ! Their max speed ENDIF ELSE ADD espeed%(n%),ne_ch_max%(type_e%(n%)) IF espeed%(n%)>ne_s_max%(type_e%(n%)) espeed%(n%)=ne_s_max%(type_e%(n%)) ! Their max speed ENDIF ENDIF SUB mex%(n%),ADD(espeed%(n%),speed%) IF mex%(n%)<-320 ADD mex%(n%),960 ELSE IF mex%(n%)>640 ADD mex%(n%),-960 ENDIF IF mex%(n%)>-30 AND mex%(n%)<320 ! Are the enemy on the screen e_visable!(n%)=TRUE ! The enemy are visible ' If Rnd(1)<E_up_down% ! How fast they can move up/down IF my%<mey%(n%) SUB mey%(n%),ne_ud_max%(type_e%(n%)) ELSE IF my%>mey%(n%) ADD mey%(n%),ne_ud_max%(type_e%(n%)) ENDIF ' Endif IF espeed%(n%)<=-2 PUT mex%(n%),mey%(n%),e$(ADD(1,type_e%(n%))),7 ELSE IF espeed%(n%)>=-1 AND espeed%(n%)<=1 PUT mex%(n%),mey%(n%),e$(ADD(2,type_e%(n%))),7 ELSE IF espeed%(n%)>=2 PUT mex%(n%),mey%(n%),e$(ADD(3,type_e%(n%))),7 ENDIF ENDIF ENDIF NEXT n% RETURN ' ------------------------------ SCROLL THE Landscape ------------------------- PROCEDURE landscape FOR n%=1 TO 4 ! Do landscape SUB posx%(n%),speed% IF posx%(n%)<-320 ADD posx%(n%),1280 ELSE IF posx%(n%)>640 ADD posx%(n%),-1280 ENDIF NEXT n% FOR n%=1 TO 4 IF posx%(n%)>-319 AND posx%(n%)<319 PUT posx%(n%),158,l$(n%),7 ENDIF NEXT n% ' ---------------- SUB moonx%,(speed%*0.5) ! Is the moon on the screen IF moonx%<-320 ADD moonx%,1280 ELSE IF moonx%>640 ADD moonx%,-1280 ENDIF IF moonx%>-110 AND moonx%<320 PUT moonx%,10,moon$,7 ENDIF ' ---------------- SUB small_moonx%,(speed%*0.5) ! Is the small moon on the screen IF small_moonx%<-320 ADD small_moonx%,1280 ELSE IF small_moonx%>640 ADD small_moonx%,-1280 ENDIF IF small_moonx%>-70 AND small_moonx%<320 PUT small_moonx%,70,small_moon$,7 ENDIF ' ---------------- SUB saturnx%,(speed%*0.5) ! Is the saturn on the screen IF saturnx%<-320 ADD saturnx%,1280 ELSE IF saturnx%>640 ADD saturnx%,-1280 ENDIF IF saturnx%>-190 AND saturnx%<320 PUT saturnx%,20,saturn$,7 ENDIF RETURN ' -------------------------------- Joystick ------------------------ PROCEDURE joystick stk%=STICK(1) ! Read joystick IF stk%=1 OR stk%=9 OR stk%=5 SUB my%,4 IF my%<8 my%=8 ENDIF ENDIF IF stk%=2 OR stk%=6 OR stk%=10 ADD my%,4 IF my%>180 my%=180 ENDIF ENDIF IF stk%=4 OR stk%=5 OR stk%=6 IF yright! turnship!=TRUE ts%=2 ELSE @adjustspeed ENDIF ENDIF IF stk%=8 OR stk%=9 OR stk%=10 IF yright! @adjustspeed ELSE turnship!=TRUE ts%=2 ENDIF ENDIF RETURN ' ------------------------------ TURN SHIP --------------------------- PROCEDURE turnship IF turnship!=TRUE IF yright! ts%=3 yr%=-1 yright!=FALSE ELSE yright!=TRUE yr%=1 ts%=1 ENDIF turnship!=FALSE ENDIF RETURN ' ---------------------------- ADJUST SPEED ------------------------------ PROCEDURE adjustspeed INC dec_max_speed% IF MOD(dec_max_speed%,40)=0 IF max_speed%>2 DEC max_speed% ENDIF ENDIF IF yright! INC speed% IF speed%>max_speed% speed%=max_speed% ENDIF ELSE DEC speed% IF speed%<-max_speed% speed%=-max_speed% ENDIF ENDIF RETURN ' ----------- FIRE YOUR ROCKETS AT THE ENEMY --------------------------- PROCEDURE firerockets IF STRIG(1) FOR n%=1 TO num_rockets% IF fire!(n%)=FALSE AND t!=FALSE THEN t!=TRUE fire!(n%)=TRUE IF yright! fx%(n%)=ADD(mx%,30) ELSE fx%(n%)=ADD(mx%,0) ENDIF fy%(n%)=ADD(my%,11) finc%(n%)=MUL(15,yr%) ENDIF NEXT n% ENDIF t!=FALSE ' Defline 1,0,0,1 COLOR 1 FOR n%=1 TO num_rockets% IF fire!(n%) fxs%=ADD(fx%(n%),fact%(n%)) ' Line Fxs%,Fy%(N%),Add(Fxs%,5),Fy%(N%) IF fxs%>0 AND fy%(n%)>0 AND ADD(fxs%,5)<319 AND fy%(n%)<199 ALINE fxs%,fy%(n%),ADD(fxs%,5),fy%(n%),1,&HFFFF,2 ADD fact%(n%),finc%(n%) IF ADD(fact%(n%),fx%(n%))>310 OR ADD(fact%(n%),fx%(n%))<0 fire!(n%)=FALSE fact%(n%)=0 ENDIF ENDIF ! for aline test ENDIF NEXT n% RETURN ' ---------- INCOMING, SEE IF THE ENEMY HAS HIT YOU -------------------- PROCEDURE incomming FOR ne%=1 TO num_enemy% FOR nn%=1 TO num_e_rockets%(type_e%(ne%)) efxs%=SUB(ADD(efx%(ne%,nn%),efact%(ne%,nn%)),efinc%(ne%,nn%)) IF efire!(ne%,nn%) ' Box Add(Mx%,Hitx1%),Add(My%,Hity1%),Add(Mx%,Hitx2%),Add(My%,Hity2%) ' Box Efxs%+2,Efy%(Ne%,Nn%)+2,Efxs%-2,Efy%(Ne%,Nn%)-2 IF efxs%>ADD(mx%,hitx1%) AND efy%(ne%,nn%)>ADD(my%,hity1%) AND efxs%<ADD(mx%,hitx2%) AND efy%(ne%,nn%)<ADD(my%,hity2%) IF shields%>0 @explode2 COLOR 3 ELLIPSE ADD(mx%,17),ADD(my%,7),20,10 DEC shields% efire!(ne%,nn%)=FALSE efact%(ne%,nn%)=FALSE ENDIF ENDIF ENDIF NEXT nn% NEXT ne% RETURN ' -----------------COLLISION, SEE IF YOU HAVE HIT THE ENEMY --------------- PROCEDURE collision FOR nn%=1 TO num_rockets% fxs%=SUB(ADD(fx%(nn%),fact%(nn%)),finc%(nn%)) IF fire!(nn%) FOR n%=1 TO num_enemy% ' Box Add(Mex%(N%),Hitx1%),Add(Mey%(N%),Hity1%),Add(Mex%(N%),Hitx2%),Add(Mey%(N%),Hity2%) ' Box Fxs%+2,Fy%(Nn%)+2,Fxs%-2,Fy%(Nn%)-2 IF fxs%>ADD(mex%(n%),hitx1%) AND fy%(nn%)>ADD(mey%(n%),hity1%) AND fxs%<ADD(mex%(n%),hitx2%) AND fy%(nn%)<ADD(mey%(n%),hity2%) AND e!(n%) AND e_visable!(n%) @explode1 e!(n%)=FALSE ADD score%,10 DEC the_enemy% fire!(nn%)=FALSE fact%(nn%)=FALSE e_hit!(n%)=TRUE ENDIF NEXT n% ENDIF NEXT nn% FOR n%=1 TO num_enemy% IF e_visable!(n%) IF e_hit!(n%) INC blast%(n%) PUT mex%(n%),mey%(n%),b$(blast%(n%)),7 IF blast%(n%)>2 THEN blast%(n%)=0 e_hit!(n%)=FALSE IF hyperk! hyperk!=FALSE ENDIF ENDIF IF hyperk! INC hsk% IF hsk%=3 THEN hsk%=1 ENDIF PUT ADD(mx%,-15),ADD(my%,-15),h$(hsk%),7 ENDIF ENDIF ENDIF NEXT n% RETURN ' --------------------------- GET PICTURE PIECES -------------------------- ' DEGAS PICTURES CAN BE LOADED IN AND PORTIONS CUT OUT WITH THE GET COMMAND PROCEDURE cutpics1 GET 0,56,319,98,l$(1) ! Landscape 1 GET 0,99,319,141,l$(2) ! Landscape 2 GET 0,142,319,184,l$(3) ! Landscape 3 ' GET 0,0,33,12,s$(1) ! Your space ship facing right GET 0,16,33,28,s$(3) ! Your space ship facing left GET 0,30,33,39,s$(2) ! Your space ship facing center ' GET 37,0,67,18,e$(1) ! Enemy facing right GET 37,19,67,36,e$(3) ! Enemy facing left GET 37,38,67,50,e$(2) ! Enemy facing center ' GET 70,0,105,12,e$(4) ! Enemy facing right GET 70,14,105,26,e$(6) ! Enemy facing left GET 70,29,105,38,e$(5) ! Enemy facing center ' GET 106,0,142,12,e$(7) ! Enemy facing right GET 106,14,142,26,e$(9) ! Enemy facing left GET 106,29,142,38,e$(8) ! Enemy facing center ' GET 144,0,182,12,e$(10) ! Enemy facing right GET 144,15,182,26,e$(12) ! Enemy facing left GET 144,32,182,46,e$(11) ! Enemy facing center ' GET 186,0,223,12,e$(13) ! Enemy facing right GET 186,13,223,24,e$(15) ! Enemy facing left GET 186,26,223,38,e$(14) ! Enemy facing center ' GET 225,0,262,12,e$(16) ! Enemy facing right GET 225,14,262,24,e$(18) ! Enemy facing left GET 225,27,261,38,e$(17) ! Enemy facing center ' GET 268,0,299,23,b$(2) GET 257,23,279,43,b$(1) GET 286,25,319,52,b$(3) RETURN ' --------------------------- GET PICTURE PIECES -------------------------- PROCEDURE cutpics2 GET 34,0,102,41,h$(1) ! hyperkill 1 GET 105,0,177,41,h$(2) ! hyperkill 2 GET 175,0,244,58,small_moon$ GET 125,58,319,139,saturn$ GET 0,157,319,199,l$(4) RETURN ' -------------------------- CLEAN UP AT END ----------------------------- PROCEDURE clean_up STICK (0) SHOWM a%=MAX(a%,b%) VOID XBIOS(5,L:a%,L:a%,-1) SPUT h$ @restorepal ERASE spalette%() EDIT RETURN ' ---------------------- SAVE ORIGINAL COLOR PALETTE ----------------------- PROCEDURE save_pal FOR z%=0 TO 15 DPOKE CONTRL,26 DPOKE CONTRL+2,0 DPOKE CONTRL+6,2 DPOKE INTIN,z% DPOKE INTIN+2,0 VDISYS spalette%(z%,0)=DPEEK(INTOUT+2) spalette%(z%,1)=DPEEK(INTOUT+4) spalette%(z%,2)=DPEEK(INTOUT+6) NEXT z% RETURN ' ---------------------------- RESTORES PALETTE ----------------------------- PROCEDURE restorepal FOR z%=0 TO 15 DPOKE CONTRL,14 DPOKE CONTRL+2,0 DPOKE CONTRL+6,4 DPOKE INTIN,z% DPOKE INTIN+2,spalette%(z%,0) DPOKE INTIN+4,spalette%(z%,1) DPOKE INTIN+6,spalette%(z%,2) VDISYS NEXT z% RETURN ' ------------------------------ DO SOUNDS ---------------------------- PROCEDURE explode1 SOUND 1,8,4095 WAVE 7689,1,9,5851 RETURN PROCEDURE explode2 SOUND 1,8,4095 WAVE 7689,1,9,52851 RETURN PROCEDURE ds1(snd%,snd1%) SOUND 1,12,snd%,snd1% WAVE 1,1,9,6000 RETURN PROCEDURE ds2(snd%,snd1%) SOUND 1,12,snd%,snd1% WAVE 1,1,8,512,5 WAVE 0,0 RETURN ' PROCEDURE deg_load(filename$,pal!) ! Loads an uncompressed DEGAS picture LOCAL n%,x#,y#,z#,c# OPEN "I",#1,filename$ SEEK #1,2 ! Move to first DEGAS color byte. FOR n%=0 TO 15 ! (First 2 bytes are DEGAS resolution info) x#=INP(#1) y#=INP(#1) z#=x#*256+y# IF pal! c#=XBIOS(7,n%,z#) ENDIF NEXT n% BLOAD filename$,XBIOS(2)-34 CLOSE #1 RETURN '